package com.example.demo.controller;

import com.example.demo.entity.Result;
import com.example.demo.entity.req.GetEmpsRes;
import com.example.demo.service.EmpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
public class EmpController {
    @Autowired
    private EmpService empService;
    //条件分页查询
    @PostMapping("/emps")
    public Result getEmps(@RequestBody GetEmpsRes params)
    {
        try{
            return new Result().success(empService.getEmps(params));
        } catch (Exception e) {
            log.error(e.getMessage());
            return new Result().error("查询失败");
        }
    }
}